﻿@{
    Layout = "~/_SiteLayout.cshtml";
}
<form action="" method="post">
<div style="margin-bottom:4px;">
    <select onchange="treecng(this.value);" id="showtype" class="myselect" style="width:110px;">
        <option value="0">组织机构</option>
        <option value="1">工作组</option>
    </select><input type="button" style="margin-left:5px;" class="mybutton" id="addWg" onclick="parent.frames[1].location='WorkGroupAdd'+'@Request.Url.Query'" value="添加工作组" style="display:none;" />
</div>
<div id="menu"></div>
</form>
    <script type="text/javascript">
        var orgTree = null;
        var AppID = '@Request.QueryString["appid"]';
        $(function ()
        {
            treecng($("#showtype").val());
        });
        function treecng(val)
        {
            if (!val)
            {
                val = $("#showtype").val();
            }
            if ("1" == val)
            {
                $("#addWg").show();
            }
            else
            {
                $("#addWg").hide();
            }
            orgTree = new RoadUI.Tree({ id: "menu", path: "Tree1?showtype=" + val, refreshpath: "TreeRefresh?showtype=" + val, onclick: openurl });
            parent.frames[1].location = 'Empty?appid=' + AppID;
        }
        
        function openurl(json)
        {
            var query = "&appid=" + AppID + "&parentid=" + json.parentID+"&type="+json.type;
            switch (parseInt(json.type))
            {
                case 1:
                case 2:
                case 3:
                    parent.frames[1].location = "Body?id=" + json.id + query;
                    break;
                case 4:
                    parent.frames[1].location = "User?id=" + json.id + query;
                    break;
                case 5:
                    parent.frames[1].location = "WorkGroup?id=" + json.id + query;
                    break;
            }
        }

        function reLoad(id)
        {
            orgTree.refresh(id);
        }
    </script>